﻿
namespace Anderson.NetLobby.MessageContent
{
    /// <summary>
    /// 0x 00 00 00 00
    /// 最左侧的1个字节：服务端还是客户端
    /// 从左数第2个字节：层级1
    /// 从左数第3个字节：层级2
    /// 从左数第4个字节：层级3
    /// 
    /// 简写：
    /// REQ - Request(一般指客户端对服务器发出的功能或数据的请求)
    /// RES - Response(一般服务端对客户端请求的处理结果的反馈)
    /// CMD - Command(一般指服务端发出的命令）
    /// CFM - Confirm(一般值客户端对服务端命令的确认或反馈)
    /// </summary>
    public class MessageLevelDefinition
    {
        #region MASK
        public const uint MASK_CLIENT_L1_BIZ            = 0xFFFF0000;
        #endregion

        #region Level-1-Server
        public const uint SERVER_L1_SYSTEM              = 0x01010000;
        #endregion

        #region Level-2-Server
        public const uint SERVER_L2_SYSTEM_HEART        = 0x01010100;
        public const uint SERVER_L2_SYSTEM_PLAYERID     = 0x01010200;
        #endregion

        #region Level-3-Server
        public const uint SERVER_L3_SYSTEM_HEART        = 0x01010101;

        public const uint SERVER_L3_SYSTEM_PLAYERID_CMD = 0x01010201;
        public const uint CLIENT_L3_SYSTEM_PLAYERID_CFM = 0x02010202;
        #endregion

        #region Level-1-Client
        public const uint CLIENT_L1_ROOM                = 0x02010000;
        public const uint CLIENT_L1_BIZ                 = 0x02800000;   //具体业务逻辑，服务器端检测出来后，不需要拆包，直接转发客户端
                                                                        //不是说业务类型的L1就等于0x02800000，而是指用0x0280开头
        #endregion

        #region Level-2-Client        
        public const uint CLIENT_L2_ROOM_CREATE         = 0x02010100;
        public const uint CLIENT_L2_ROOM_LIST           = 0x02010200;
        public const uint CLIENT_L2_ROOM_ACTION         = 0x02010300;
        #endregion

        #region Level-3-Client
        public const uint CLIENT_L3_ROOM_CREATE_REQ     = 0x02010101;
        public const uint SERVER_L3_ROOM_CREATE_RES     = 0x01010102;//创建不一定成功，如房间数量限制；所以需要反馈结果

        public const uint CLIENT_L3_ROOM_LIST_GET_REQ   = 0x02010201;
        public const uint SERVER_L3_ROOM_LIST_GET_RES   = 0x01010202;//返回获取的房间列表信息
        public const uint SERVER_L3_ROOM_LIST_CHANGED   = 0x01010203;//房间信息发生了变化

        public const uint CLIENT_L3_ROOM_ENTER_REQ      = 0x02010301;
        public const uint SERVER_L3_ROOM_ENTER_RES      = 0x01010302;//因为加入房间不一定允许（个数限制）；所以需要反馈结果
        public const uint CLIENT_L3_ROOM_EXIT_REQ       = 0x02010303;
        public const uint CLIENT_L3_ROOM_START_REQ      = 0x02010304;
        public const uint SERVER_L3_ROOM_START_RES      = 0x01010305;//房间所有人都执行了开始后发送反馈
        public const uint CLIENT_L3_ROOM_CLOSE_REQ      = 0x02010306;//房主主动关闭房间
        public const uint SERVER_L3_ROOM_CLOSE_RES      = 0x01010307;//房主主动关闭房间，已经在房间的用户需要被通知（房主自己除外）
        #endregion
    }
}
